import { request } from '@umijs/max';

/**
 * 保存消息 POST /api/message/save
 */
export async function saveMessage(sendName:string,receiveName:string,message:string,goodsId:number,isParent:number,createName?:string){
  return request('/api/message/save',{
    method: 'POST',
    data:{
      sendName: sendName,
      receiveName: receiveName,
      message: message,
      goodsId:goodsId,
      isParent: isParent,
      createName:createName
    }
  });
}

/**
 * 获取留言信息 GET /api/message/getMsg
 */
export async function getMessage(userId:number){
  return request<API.MessageParent[]>('/api/message/getMsg',{
    method: 'GET',
    params:{
      userId: userId,
    }
  });
}

/**
 * 修改状态信息 GET /api/message/status
 */
export async function updateStatus(parentId:number){
  return request<boolean>('/api/message/status/'+parentId,{
    method:'GET'
  })
}
